package com.silverhaze.diamond.common.service;

import com.silverhaze.commons.db.datasource.DataSource;
import com.silverhaze.commons.db.datasource.DataSourceListener;
import com.silverhaze.commons.db.datasource.ObjectEntity;
import com.silverhaze.commons.utils.collections.list.MetaList;
import com.silverhaze.diamond.common.constants.DiamondConstants;

import java.util.List;

/**
 * User: Babanin
 * Date: 31.03.11
 * Time: 0:50
 */
public interface DataSourceServiceRemote {
    public static final String NAME = DiamondConstants.JNDI_DOMAIN + "DataSourceService";

    public long persist(ObjectEntity o);

    public void remove(ObjectEntity o);

    public boolean update(ObjectEntity o);

    public <T extends ObjectEntity> MetaList<T> get(Class<T> clazz);

    public <T extends ObjectEntity> T get(Class<T> clazz, int id);

    public List queryList(String query);

    public Object queryUniqueResult(String query);


    public void addDataSourceListener(DataSourceListener listener);

    public void removeDataSourceListener(DataSourceListener listener);
}
